<template>
	<view>
		<!-- 直接材料报销审核 -->
		<view class="head_tb">
			<u-tabs :activeStyle="{
						 fontSize:'32rpx',
						 color: '#007aff'
			         }" :inactiveStyle="{
						 fontSize:'30rpx'
			         }" :scrollable='false' :lineWidth='30' itemStyle='height:90rpx;padding:0 0' :list="list1"
				@click="checkbtn"></u-tabs>
		</view>
		<!-- 基本信息 -->
		<view class="msp">
			<CellChild :addlist='addlist' :rows='rows' title='基本信息' isshow='true' :fileNo = 'fileNo' id='add_one'>
			</CellChild>
		</view>
		
		<!-- 报销金额 -->
		<view class="msp">
			<CellChild :addlist='addlist1' :rows='rows' title='报销金额' isshow='true'>
			</CellChild>
		</view>
		
		<!-- 发票信息 -->
		<view class="formcard" id="add_two">
			<view class="bodtitle">
				<p><b>发票信息</b></p>
			</view>
			<view v-for="(item,index) in invoiceList">
				<Expandlist :cellshows='cellshow' :arrcell = 'item' :celllist='celllist' :title='item.invoiceNo'>
				</Expandlist>
			</view>
		</view>
		
		
		<!-- 收货单/订单信息 -->
		<view class="formcard" id="add_three">
			<view class="bodtitle">
				<p><b>收货单/订单信息</b></p>
			</view>
			
			
			<view v-for="(item,index) in orderList" :key='index'>
				<Expandlist :cellshows='cellshow' :arrcell = 'item'  :celllist='celllist2' :title='item.orderNo'></Expandlist>
			</view>
		</view>
		
		<!-- 收款方信息 -->
		<view class="formcard" id="add_three">
			<view class="bodtitle">
				<p><b>收货单/订单信息</b></p>
			</view>
			
			
			<view v-for="(item,index) in bankList" :key='index'>
				<Expandlist :cellshows='cellshow' :arrcell = 'item'  :celllist='celllist3' :title='item.payee'></Expandlist>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		components:{
		},
		data() {
			return {
				list1: [{
						name: '基本信息',
					},
					{
						name: '发票信息'
					},
					{
						name: '收货单/订单信息'
					},
				],
				cellshow:false,
				addlist: [{
						tit: '单据编号',
						val: 'billNo'
					},
					{
						tit: '填报日期',
						val: 'billDate'
					},
					// {
					// 	tit: '项目合同',
					// 	val: 'projectContract'
					// },
					{
						tit: '原始单据粘贴单张数',
						val: 'fileCout'
					},
					{
						tit: '报销部门',
						val: 'subdeptNm'
					},
					{
						tit: '报销人',
						val: 'userDesc'
					},
					{
						tit: '工号',
						val: 'userId'
					},
					{
						tit: '联系电话',
						val: 'phone'
					},
					{
						tit: '差异说明',
						val: 'remakrs'
					},					
				],
				addlist1: [{
						tit: '报销金额合计',
						val: 'reimAmountCount',
						type:'number'
					},
					{
						tit: '审核报销金额合计',
						val: 'appReimAmount',
						type:'number'
					},{
						tit: '原借款或预付货款金额',
						val: 'loanAmount',
						type:'number'
					},{
						tit: '报销后应付款',
						val: 'afterPayAmount',
						type:'number'
					},{
						tit: '报销后应收款',
						val: 'afterGetAmount',
						type:'number'
					},
					
				],
				celllist:[
					{tit:'供应商',val:'businessCompanyCode'},
					{tit:'发票日期',val:'invoiceDate'},
					{tit:'货币',val:'currency'},
					{tit:'发票参考',val:'invoiceDesc'},
					{tit:'发票含税金额',val:'taxAmount',type:'number'},
					{tit:'进项税额',val:'inputTax',type:'number'},
					{tit:'支付方式',val:'payType'},
					{tit:'到期日期',val:'endDate'},
					{tit:'差异金额',val:'diffAmt',type:'number'},
				],
				celllist2:[
					{tit:'收货单号',val:'takeOrder'},
					{tit:'订单行号',val:'orderLineNo'},
					{tit:'物料号',val:'partNo'},
					{tit:'项目描述',val:'remarks'},
					{tit:'收货单价',val:'price',type:'number'},
					{tit:'数量',val:'quanlity'},
					{tit:'匹配价格',val:'factPrice',type:'number'},
					{tit:'匹配数量',val:'factQuanlity'},
					{tit:'匹配不含税金额',val:'noTaxAmount',type:'number'},
				],
				celllist3:[
					{tit:'收款方类型',val:'payeeType'},
					{tit:'收款方',val:'payee'},
					{tit:'收款方开户银行',val:'payeeBank'},
					{tit:'收款方开户账号',val:'bankcardNo'},
					{tit:'支付金额',val:'payAmt',type:'number'},
				],
				rows:[],
				invoiceList:[], //发票信息
				orderList:[], //收货订单
				bankList:[], //收款方
				fileNo:[]//附件
			}
		},
		onLoad() {
			let billNo= window.parent.myvm.wfContext.BusinessKey;
			this.fileNo = window.parent.myvm.wfContext.BusinessKey;
			this.getlist(billNo)
		},
		created() {
		},
		mounted() {
			var that = this;
			window.myvm = that;
			window.$urlFormVue = that;
		},
		methods: {
			getlist(billNo){
				let _this = this
				const params ={
					billNo
				}
				_this.$lyRequest.get('/gateway/reim/mp/dbsap/reim/materilaEntity/queryMasterInfo.do',
					params
				).then((result)=>{
					if(result.success){
						// console.log(result)
						this.rows = result.data.rows
						this.invoiceList = result.data.rows.invoiceList
						this.orderList = result.data.rows.orderList
						this.bankList = result.data.rows.bankList
						if(this.bankList.payeeType == '0'){
							this.bankList.payeeType = '对私'
						}else if(this.bankList.payeeType == '1'){
							this.bankList.payeeType = '对公'
						}
					}else{
						console.log(result.data.msg)
					}
				})
			},
			//审批和驳回-工作流点击"提交"时触发此函数，返回:空字符串:工作流继续提交，返回"具体错误信息":工作流不提交
			rejectWorkflow(btnDef) {
				return "";
			},
			//作废-工作流点击"作废"时触发此函数，返回:空字符串:工作流继续提交，返回"具体错误信息":工作流不提交
			//content为作废意见
			invalidWorkflow(content) {
				return "";
			},
			//转办-工作流点击"确认转办"时触发此函数，返回:空字符串:工作流继续提交，返回"具体错误信息":工作流不提交
			//opinion:转办意见
			referredWorkflow(opinion) {
				return "";
			},
			//校验-工作流点击"提交"时触校验函数，返回:true校验通过，false校验不通过；
			//也可以返回具体的错误信息：空字符串，校验通过，返回具体错误信息校验不通过，同时弹出具体的错误信息。
			validateWorkflowForm(btnDef,callback) {
				callback("");
			},
			//提交单据
			sendWorkflow(btnDef, callback) {
				callback("");
			},
			checkbtn(item) { //切换tabs
				if (item.index === 0) {
					this.commonApi.goAnchor('add_one')
				} else if (item.index === 1) {
					this.commonApi.goAnchor('add_two')
				} else if (item.index === 2) {
					this.commonApi.goAnchor('add_three')
				}
			},
		}
	}
</script>

<style scoped lang="scss">
view{
	font-family: pf;
}
.bodcolor{
		span{
			color:#ff6400;
			font-size: 36rpx;
			padding-right: 20rpx;
		}
		label{
			color: #ff6400;
		}
	}
	
</style>
